/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author adriancruz11c
 */

public class PruebaAntonymy {
     
     public static boolean mainn(String ul1, String ul2) {         
        String []arrPatternLexA={"ab","anti","dis", "im", "in", "mal", "mis", "non", "un"};
        
        String [][]MatrixPatternPrefixLexA={{"l",   "r", "im", "in","up",  "over"}, 
                                {"ill",  "ir", "ex", "ex","down","under"}};         
        String [][]MatrixPatternSuffixLexA={{"less"}, 
                                {"ful"}};
        if (MatchPatternLexA(ul1,ul2, arrPatternLexA, MatrixPatternPrefixLexA, MatrixPatternSuffixLexA))
            return true;
        return false;
     }
     public static boolean MatchPatternLexA(String ul1, String ul2, String []arrPattern){
         for (String x: arrPattern){
            if (ul1.startsWith(x)){
               if (ul1.equals(x+ul2)) 
                  return true;      
            }                    
         }         
         return false;
     }
     public static boolean MatchPatternLexA(String ul1, String ul2, String [][]MxPattern){
         String X="";
         for (int i=0; i<MxPattern[0].length; i++){
             if (ul1.startsWith(MxPattern[0][i])){
                 X=ul1.substring(MxPattern[0][i].length(), ul1.length()); //CHECK                 
                 if(ul2.equals(MxPattern[1][i]+X))
                         return true;
             }
         }         
         return false;
     }
     public static boolean MatchPatternSuffixLexA(String ul1, String ul2, String [][]MxPattern){
         String X="";
         for (int i=0; i<MxPattern[0].length; i++){
             if (ul1.endsWith(MxPattern[0][i])){
                 X=ul1.substring(0, ul1.length()-MxPattern[0][i].length()); //CHECK                 
                 if(ul2.equals(X+MxPattern[1][i]))
                         return true;
             }
         }         
         return false;
     }
     public static boolean MatchPatternLexA(String ul1, String ul2,
         String []arrPatternLexA, String [][]MatrixPatternPrefixLexA, String [][]MatrixPatternSuffixLexA){         
         boolean matchAnt=false;

         
         if (MatchPatternLexA(ul1, ul2, arrPatternLexA))
             return true;
         if (MatchPatternLexA(ul2, ul1, arrPatternLexA))
             return true;         
         
         if (MatchPatternLexA(ul1, ul2,MatrixPatternPrefixLexA))
             return true;
         if (MatchPatternLexA(ul2, ul1,MatrixPatternPrefixLexA))
             return true;   
         if (MatchPatternSuffixLexA(ul1, ul2,MatrixPatternSuffixLexA))
             return true;
         if (MatchPatternSuffixLexA(ul2, ul1,MatrixPatternSuffixLexA))
             return true;         
         
         
         return false;
     }







    
}
